package uodm.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.event.dom.client.ClickEvent;

public class AddOfficeWidget extends Composite {

	private AddOfficeEntry entry;

	private static AddOfficeWidgetUiBinder uiBinder = GWT
			.create(AddOfficeWidgetUiBinder.class);

	interface AddOfficeWidgetUiBinder extends UiBinder<Widget, AddOfficeWidget> {
	}

	@UiField
	TextBox officeNameBox;
	@UiField
	TextArea officeNoteBox;
	@UiField
	Label messageLabel;

	public AddOfficeWidget(AddOfficeEntry addOfficeEntry) {
		this.entry = addOfficeEntry;
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiHandler("submitButton")
	void onSubmitButtonClick(ClickEvent event) {
		entry.on_submitButton_clicked();
	}

	@UiHandler("cancelButton")
	void onCancelButtonClick(ClickEvent event) {
		entry.redirectToList();
	}

}
